<%@page contentType="text/html"%>  
<%@page pageEncoding="UTF-8"%>  

<%@taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
<%@taglib prefix="h" uri="http://java.sun.com/jsf/html"%>  
<%@taglib uri="http://richfaces.org/a4j" prefix="a4j"%>  
<%@taglib uri="http://richfaces.org/rich" prefix="rich"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<%@taglib uri="http://myfaces.apache.org/tomahawk" prefix="t"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"   
"http://www.w3.org/TR/html4/loose.dtd">  
<html>
    <head>
        <title>Usuário</title>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <meta http-equiv="Pragma" content="no-cache">
        <meta http-equiv="cache-control" content="no-cache">
        <meta http-equiv="cache-control" content="no-store">
        <meta http-equiv="expires" content="0">
    </head>
    <style type="text/css"><!--@import url("../_css/style.css");--></style>
    <body>
        <f:view>
            <h:form>
                <rich:simpleTogglePanel switchType="client" label="Usuário" width="95%">
                    <h:commandButton value="Novo" action="#{UsuarioBean.incluir}"/>&nbsp;&nbsp;
                </rich:simpleTogglePanel>
                <rich:dataTable id="tblUsuarios" value="#{UsuarioBean.listaUsuarios}" var="usu"
                                width="95%" columnClasses="center" rows="50" reRender="ds">
                    <rich:column width="40px">
                        <f:facet name="header">
                            <h:outputText value="ID"/>
                        </f:facet>
                        <h:outputText value="#{usu.id}"/>
                    </rich:column>
                    <rich:column filterBy="#{usu.nome}" filterEvent="onkeyup" breakBefore="false" sortBy="#{usu.nome}">
                        <f:facet name="header">
                            <h:outputText value="Nome"/>
                        </f:facet>
                        <h:outputText value="#{usu.nome}"/>
                    </rich:column> 
                    <rich:column>
                        <f:facet name="header">
                            <h:outputText value="Login"/>
                        </f:facet>
                        <h:outputText value="#{usu.login}"/>
                    </rich:column>
                    <rich:column>
                        <f:facet name="header">
                            <h:outputText value="Regra"/>
                        </f:facet>
                        <h:outputText value="#{usu.regra.nome}"/>
                    </rich:column>
                    <rich:column width="50px">
                        <f:facet name="header">
                            <h:outputText value="Ações"/>
                        </f:facet>
                        <h:commandButton image="../_images/btn_alterar.gif" title="Alterar Registro" binding="#{UsuarioBean.btnAlterar}" value="#{usu.id}" action="#{UsuarioBean.alterar}"/>&nbsp;
                        <h:commandButton image="../_images/btn_excluir.gif" title="Exluir Registro" binding="#{UsuarioBean.btnExcluir}" value="#{usu.id}" action="#{UsuarioBean.excluir}"/>
                    </rich:column>
<%--
                    <f:facet name="footer">
                        <rich:datascroller id="ds"></rich:datascroller>
                    </f:facet>
--%>
                </rich:dataTable>
                <a4j:status>
                    <f:facet name="start">
                        <h:graphicImage value="../_images/img_load.gif"/>
                    </f:facet>
                </a4j:status>
            </h:form>
        </f:view>
    </body>
</html>